package com.ruoyi.visitor.service.impl;

import java.util.List;

import cn.hutool.core.date.DateTime;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.visitor.mapper.VisitorAppointmentMapper;
import com.ruoyi.visitor.domain.VisitorAppointment;
import com.ruoyi.visitor.service.IVisitorAppointmentService;
import com.ruoyi.common.core.text.Convert;

/**
 * 访客预约记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-12
 */
@Service
public class VisitorAppointmentServiceImpl implements IVisitorAppointmentService 
{
    @Autowired
    private VisitorAppointmentMapper visitorAppointmentMapper;

    /**
     * 查询访客预约记录
     * 
     * @param id 访客预约记录主键
     * @return 访客预约记录
     */
    @Override
    public VisitorAppointment selectVisitorAppointmentById(Long id)
    {
        return visitorAppointmentMapper.selectVisitorAppointmentById(id);
    }

    /**
     * 查询访客预约记录列表
     * 
     * @param visitorAppointment 访客预约记录
     * @return 访客预约记录
     */
    @Override
    public List<VisitorAppointment> selectVisitorAppointmentList(VisitorAppointment visitorAppointment)
    {
        return visitorAppointmentMapper.selectVisitorAppointmentList(visitorAppointment);
    }

    /**
     * 新增访客预约记录
     * 
     * @param visitorAppointment 访客预约记录
     * @return 结果
     */
    @Override
    public int insertVisitorAppointment(VisitorAppointment visitorAppointment)
    {
        visitorAppointment.setCreateTime(DateUtils.getNowDate());
        return visitorAppointmentMapper.insertVisitorAppointment(visitorAppointment);
    }

    /**
     * 修改访客预约记录
     * 
     * @param visitorAppointment 访客预约记录
     * @return 结果
     */
    @Override
    public int updateVisitorAppointment(VisitorAppointment visitorAppointment)
    {
        visitorAppointment.setUpdateTime(DateTime.now());
        return visitorAppointmentMapper.updateVisitorAppointment(visitorAppointment);
    }

    /**
     * 批量删除访客预约记录
     * 
     * @param ids 需要删除的访客预约记录主键
     * @return 结果
     */
    @Override
    public int deleteVisitorAppointmentByIds(String ids)
    {
        return visitorAppointmentMapper.deleteVisitorAppointmentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除访客预约记录信息
     * 
     * @param id 访客预约记录主键
     * @return 结果
     */
    @Override
    public int deleteVisitorAppointmentById(Long id)
    {
        return visitorAppointmentMapper.deleteVisitorAppointmentById(id);
    }
}
